import CONSTANT from '@/common/constants.js';
import http from '@/common/http.js';
import navBottom from '../common/nav-bottom.vue'
import Flexbox from 'vux/src/components/flexbox/flexbox.vue'
import FlexboxItem from 'vux/src/components/flexbox/flexbox-item.vue'
import XProgress from 'vux/src/components/x-progress/index.vue'
export default {
  name: 'donationFeedBack',
  components: { Flexbox, FlexboxItem, XProgress, navBottom },
  data () {
    return {
      eventListQB: '',
      pageSize: 10,
      pageNo: 1,
      noMoreEvent: '点击加载更多',
      event_type: ''
    }
  },
  mounted () {
    this.goEvent()
  },
  methods: {
    upEvents () {
      this.pageNo--;
      if (this.pageNo <= 0) {
        this.pageNo++;
        alert('已经是第一页了')
        return
      } else {
        this.goEvent();
      }
    },
    nextEvents () {
      this.pageNo++;
      this.goEvent();
    },
    goEvent () {
      http.post(CONSTANT.EVENT_PAST, {
        event_type: this.event_type,
        pageNo: this.pageNo,
        pageSize: this.pageSize
      }, (res) => {
        console.log(res)
        if (res.code == 200) {
          if (res.errmsg == '没有更多的项目') {
            if (this.pageNo > 1) {
              this.pageNo--
            }
            alert('已经是最后一页了！')
            return
          }
          this.eventListQB = res.list
        }
      })
    },
    goProject (e) {
      console.log(e)
      window.sessionStorage.setItem('event_id', e)
      this.$router.push({path: '/Project'})
    },
    comeBack () {
      window.history.go(-1)
    }
  }
}
